home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
BARNET
/
FREENET
/
JONES
/
LOGIN
/
doc
/
login
next >
Wrap
Text File
|
1995-08-29
|
5KB
|
114 lines
Readme file for login.
This program is Copyright (C) 1994,1995 Alun Jones, auj@aber.ac.uk
It is freeware, which means you can copy it freely, on the condition that
you don't charge more than a nominal fee for the distribution media. You're
welcome to make changes to the source code, recompile it, or whatever. I'd
like to keep track of any interesting additions, and am happy to receive bug
reports.
Instructions for login
Login is a clone of the Unix login program. It is a command-line program and
is intended to be placed within your bootup sequence before the desktop
starts. At this early point, it is possible to stop (clueless) people from
accessing facilities on your machine without logging in.
Login prompts for a username (if not passed on the command line) and
password. It then encrypts this password and compares it with the stored
value in /etc/passwd. If this is the same then it assumes that the user is
who they say they are and proceeds to perform a number of actions:
1. It sets the system variable, USER to be the entered username. This
variable is made read-only using a code variable. Making variables
readonly is not a foolproof protection by any means, but it makes it a
little more difficult to change username without validations.
2. Similarly, the system variables, Unix$uid and Unix$gid are set from the
values in the password file. These are used internally by some UnixLib
programs.
3. NAME is set from the password file entry. This is not made read-only by
default, but see later.
3. HOME is set, again from the password file entry, to the user's home
directory. The user root directory (URD) is also set to this value.
4. If a file matching (*) the name "/etc/loginrc" exists, then this file is
executed. The intention is that this should be an obey file containing
commands which should by run when all users login.
(*) "matching" indicates that the standard UnixLib mappings apply. See
below.
5. The current working directory (CWD) is set to the URD. If a file
matching the name ".login" exists, then this file is executed. Again,
the intention is that this should be an obey file.
6. If a file matcing the name <Mail$Dir>/user (where user is the username)
exists, then "You have mail" is printed.
7. If the pw_shell field for the user starts with an *, then this field is
immediately run. For example, I have the following line in my passwd
file:
shutdown::4:0:System Shutdown:/:*shutdown
So, if I reboot, but don't want to wait for the desktop to start, I can
login as shutdown, with no password. This will cause the machine to
shutdown.
UnixLib requirements.
The program was written using the UnixLib library, and Paul Moore's Utils
library for the fcrypt function. Therefore, pathnames are translated from
Unix conventions to RISC OS conventions.
This affects matters in three ways:
1. The directory, /etc, will be searched for as $.etc on the current
filing system unless the variable UnixFS$/etc is set. My setup uses
Set UnixFS$/etc SCSI::Scuzzy.$.etc
to indicate the relevant directory.
2. ".login" maps to the RISC OS name, "/login".
3. Home directories *must* be specified in the Unix way. Since the passwd
file uses : as a field seperator, a home directory of
SCSI::Scuzzy.$.home.auj
cannot be stored. Rather, I use /home/auj, and have a UnixFS$/home
variable referring to the true home directory. Note that login translates
this directory to the appropriate RISC OS name before storing it in the
HOME system variable.
One other UnixLib consideration: The gethostname() function in standard
UnixLib merely returns "acornXX", where XX is the hexadecimal Econet
station number. This is pretty boring, so login first reads the HOST system
variable. If this is set, its value is used instead as the machine name.
The /etc/loginrc file.
As mentioned above, this file, if it exists, will be run before the user's
own .login file. You can therefore run commands for the user as they login.
At the point where it is run, all the variables normally set by login have
been set, as has the URD. This file can be used to set any other
user-specific variables before the user can get to them. You can use the
"readonly" utility to prevent the user from changing them, if you want.
Note, however, that once a variable is made readonly, it stays that way. So
a second invokation of login will fail to set any variables made readonly
in this file. (login itself can make variables writeable, so USER etc.
can be re-written. But supplying a utility to reverse the effects of
readonly would make readonly itself a little pointless ;-)
The /etc/loginrc can be used to avoid having seperate directories for
seperate users, if this is desired. If you think it's better to have a
single directory full of users' login scripts, you could do something like
the following:
| /etc/loginrc
| System wide login stuff
Run SCSI::Scuzzy.$.profiles.<USER>
Each user could then have an obey file in $.profiles, named after their
user-id.